﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Blackworks.Logger;
namespace Monocle.DataProvider
{
    public partial class SqlClient : IDataProvider
    {
        public readonly string _connectionString;
        public SqlClient(string connectionString)
        {
            if (string.IsNullOrEmpty(connectionString))
                throw new ArgumentNullException("connectionString", "*Argument is not allowed to be undefined.");

            _connectionString = connectionString;

        }

        public bool Ping()
        {
            return true;
        }

        public void LogException(Exception e, String Method)
        {
            Log.WriteExceptionLogEntry(String.Format("The webmethod " + Method + " failed with Exception: " + Environment.NewLine + "{0}" + Environment.NewLine + "Stacktrace:" + Environment.NewLine + "{1}" + Environment.NewLine + "InnerException: {2}", e.Message, e.StackTrace, e.InnerException == null ? String.Empty : e.InnerException.Message), LogEntryPriority.Critical);
        }
    }
}
